const { request } = require("./config.js");
module.exports = {
  // 获取scene配置文件
  getSceneConfig: () => {
    const app = getApp()
    const { ossUrl } = app.globalData.appInfo
    return request({ url: `${ossUrl}mahjong_config/mfly/scene.json?time=${new Date().getTime()}`, data: {}, method: "GET", isThirdParty: true, });
  },
  /**
* 根据APPID 获取对应配置参数-象棋的接口
* @returns 
*/
  meta: (appId) => {
    const app = getApp()
    const { isDev } = app.globalData
    const url = isDev ? 'http://mj1.frps.qffssd.com/' : 'https://chessapp.scxjzone.com/'
    return request({ url: `${url}api/app/meta?appid=${appId}`, data: {}, method: "POST", isThirdParty: true });
  },
  /**
   * 获取匿名ID
   * @returns 
   */
  getanonymousId: (anonymous_code, code, appId) => {
    return request({ url: `api/code2session`, data: { anonymousCode: anonymous_code, code: code, appid: appId }, method: "POST" });
  },
  /**
 * 设置
 */
  settings: () => {
    return request({ url: `api/settings`, data: {}, method: "GET" });
  },
  /**
 * 收集直播间进来的数据
 */
  recordTraffic: (data) => {
    return request({ url: `api/enter_from_live_room`, data: data, method: "POST" });
  },
  /**
  * 红包封面列表-分类列表
  */
  getRedEnvelopeCoversCategories: (data) => {
    return request({ url: `api/red_envelope_cover_categories`, data: data, method: "GET" });
  },
  /**
 * 红包封面列表
 */
  getRedEnvelopeCovers: (data) => {
    return request({ url: `api/red_envelope_covers`, data: data, method: "GET" });
  },
  /**
 * 红包 detail
 */
  getRedEnvelopeCoversDetail: (data) => {
    return request({ url: `api/red_envelope_covers/${data}`, data: data, method: "GET" });
  },
  /**
   * 盲盒
  */
  getRedEnvelopeCoversBoxes: (data) => {
    return request({ url: `api/red_envelope_cover_blind_boxes`, data: data, method: "GET" });
  },
  /**
  * 盲盒 detail
  */
  getRedEnvelopeCoversDetailBox: (data) => {
    return request({ url: `api/red_envelope_cover_blind_boxes/${data}?include=Covers`, data: {}, method: "GET" });
  },
  /**
 * 红包封面下单
 */
  getRedEnvelopeOrders: (data) => {
    return request({ url: `api/red_envelope_cover_orders`, data: data, method: "post" });
  },
  /**
 * 订单状态查询
 */
  getRedEnvelopeOrdersQuery: (data) => {
    return request({ url: `api/red_envelope_cover_orders/${data}/query`, data: { include: 'Code.Cover' }, method: "get" });
  },
  /**
 * 取消订单
 */
  ordersCancel: (data) => {
    return request({ url: `api/red_envelope_cover_orders/cancel/${data.id}`, data: data, method: "post" });
  },
  /**
 * 获取记录
 */
  getHistory: (data) => {
    return request({ url: `api/red_envelope_cover_orders`, data: data, method: "get" });
  },
  /**
 * 兑换码列表
 */
  getCodeHistory: (data) => {
    return request({ url: `api/red_envelope_cover_order_codes`, data: data, method: "get" });
  },

};